package br.perfiman.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

/**
 *
 * @author Wagner Costa
 * @since 24/04/2008
 * @version 1.0
 *
 */
@Entity
public class Broker implements AbstractEntity{
	private static final long serialVersionUID = 4771518265748537311L;
	
	public static final int PAY_TYPE_STATIC = 1;
	public static final int PAY_TYPE_RANGE = 2;

	@Id
    @GeneratedValue
    protected Long id;

    @Column(length=50, nullable=false)
    protected String name;

    @Column(nullable=false)
	protected Integer payType;
    
    @Column(nullable=true)
    protected Double fractionalPrice;
    
    @Column(nullable=true)
    protected Double fullPrice;
    
    @Column(nullable=true)
    protected Double optionsPrice;
    
    @OrderBy("initialValue")
    @OneToMany(mappedBy="broker", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
    protected Set<Range> ranges;
    
    public Object getEntityId() {
    	return getId();
    }

    public Long getId(){
    	return id;
    }

	public String getName() {
		return name;
	}

	public Integer getPayType() {
		return payType;
	}

	public Double getFractionalPrice() {
		return fractionalPrice;
	}

	public Double getFullPrice() {
		return fullPrice;
	}

	public Double getOptionsPrice() {
		return optionsPrice;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPayType(Integer payType) {
		this.payType = payType;
	}

	public void setFractionalPrice(Double fractionalPrice) {
		this.fractionalPrice = fractionalPrice;
	}

	public void setFullPrice(Double fullPrice) {
		this.fullPrice = fullPrice;
	}

	public void setOptionsPrice(Double optionsPrice) {
		this.optionsPrice = optionsPrice;
	}

	public Set<Range> getRanges() {
		return ranges;
	}

	public void setRanges(Set<Range> ranges) {
		this.ranges = ranges;
	}

}